/**
 * 返回数据格式类型
 * @description: ResponseDTO
 * @author: kevinlaizhiyu@foxmail.com
 * @since: 2024/05/15
 * 001000
 * */
export default class ResponseDTO {
  code: any;
  message: any;
  data: any;

  constructor(code: number, message: string, data: any) {
    this.code = code;
    this.message = message;
    this.data = data;
  }

  static success(data: any) {
    const d = new ResponseDTO(200, "success", data);
    // console.log("success", d);
    return d;
  }

  static error(code: number, message: string) {
    return new ResponseDTO(code, message, null);
  }

  static notFound(message: string) {
    return new ResponseDTO(404, message, null);
  }
}
